//
//  UITableView+_noData.m
//  kangzhipifuyisheng
//
//  Created by 唐开江 on 15/8/5.
//  Copyright (c) 2015年 KangZhi. All rights reserved.
//

#import "UITableView+noData.h"


@implementation UITableView (noData)


- (void)checkoutEmptyWithDataArray:(NSArray *)dataArray withMessage:(NSString *)message
{
    
    
    if (dataArray.count==0)
    {
        
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0,self.height*0.3, screenWidth, 30)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = message;
        label.textColor = KZColor(167, 167, 167);
        for (UIView * view in self.subviews) {
            
            if ([view isKindOfClass:[UILabel class]]) {
                return;
            }
        }

        [self addSubview:label];
    
    }else if(!dataArray.count==0)
    {
        for (UIView * view in self.subviews) {
            
            if ([view isKindOfClass:[UILabel class]]) {
                [view removeFromSuperview];
            }
        }
        
    }
    
}
@end
